//
//  FamilyManageThreeCell.m
//  AILock
//
//  Created by 谭亚明 on 2020/6/29.
//  Copyright © 2020 tym. All rights reserved.
//

#import "RoomMangeTwoCell.h"
#import "Masonry.h"
#import "Colors.h"
#import "UserModel.h"
#import "Sizes.h"
#import "UIView+ZFFrame.h"
#import "Fonts.h"
#import "TYMLabel.h"
#import "TYMButton.h"

@interface RoomMangeTwoCell()

@property(nonatomic,weak) TYMLabel *sectionLab;
@property(nonatomic,weak) UIView *lineView;


@property(nonatomic,weak) UIImageView *headImage;
@property(nonatomic,weak) TYMLabel*titLab;


@end

@implementation RoomMangeTwoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setUserModel:(UserModel *)userModel{
    
    _titLab.text = userModel.mobile;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

-(void)initUI{
    self.backgroundColor = [UIColor whiteColor];
    
    TYMLabel *sctLab = [TYMLabel lb_text:@"房间成员" font:Font_Regular(15) color:rgba(155, 155, 155)];
    sctLab.frame = CGRectMake(15, 0, 200, 44);
    [self.contentView addSubview:sctLab];
    self.sectionLab = sctLab;
    
    
    if ([UserTool getCurrentFamily].familyRole == 1) {
        TYMButton *secBtn = [TYMButton btn_Image:@"icon_equipment10"];
        secBtn.frame = CGRectMake(ScreenWidth - 40-24, 10, 24, 24);
        [secBtn addTarget:self action:@selector(roomUserMagegeAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:secBtn];
    }
    
    
    
    UIView *conView = [[UIView alloc] initWithFrame:CGRectMake(0, 54, ScreenWidth - 30, 70)];
    conView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:conView];
    self.conView = conView;
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth- 30 , 1)];
    line.backgroundColor = rgba(242, 242, 242);
    [self.conView addSubview:line];
    self.lineView = line;
    
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_home3"]];
    image.frame = CGRectMake(15, 8.5, 30, 30);
    image.contentMode = UIViewContentModeScaleAspectFill;
    [self.conView addSubview:image];
    self.headImage = image;
    
    TYMLabel *titLab = [TYMLabel lb_text:@"家庭成员" font:Font_Medium(15) color:rgba(74, 74, 74)];
    titLab.frame = CGRectMake(50, 10, 150, 21 );
    [self.conView addSubview:titLab];
    self.titLab = titLab;
    

    
  
}

-(void)roomUserMagegeAction:(id)sender{
    if (self.roomUserManageBlock) {
        self.roomUserManageBlock();
    }
}

-(void)hiddenSectionView{
    self.sectionLab.hidden = YES;
    self.lineView.hidden = YES;
    
    self.conView.frame = CGRectMake(0, 0, ScreenWidth - 30, 46);
}

-(void)showSectionView{
    self.sectionLab.hidden = NO;
    self.lineView.hidden = NO;
    
    self.conView.frame = CGRectMake(0,53, ScreenWidth - 30, 46);
}

+(NSString*)identifier{
    return @"FamilyManageThreeCell";
}

+(CGFloat)cellForHeight{
    return 52;
}
@end
